/* eslint-disable no-tabs */
import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/layout/index.vue'
// import {
//   getToken,
//   setToken,
//   removeToken,
//   getStoreId,
//   setStoreId,
//   removeStoreId,
//   setUserInfo,
//   getUserInfo,
//   removeUserInfo,
// } from '@/utils/cookies'
// import store from '@/store'

Vue.use(Router)

import 'element-ui/lib/theme-chalk/icon.css'

const router = new Router({
  scrollBehavior: (to, from, savedPosition) => {
    if (savedPosition) {
      return savedPosition
    }
    return { x: 0, y: 0 }
  },
  //base: process.env.BASE_URL,
  routes: [
    {
      path: '/login',
      component: () => import('@/views/login/index.vue'),
      meta: { title: '中西药管理系统', hidden: true, notNeedAuth: true },
    },
    {
      path: '/404',
      component: () => import('@/views/404.vue'),
      meta: { title: '中西药管理系统', hidden: true, notNeedAuth: true },
    },
    {
      path: '/',
      component: Layout,
      redirect: '/dashboard',
      children: [
        {
          path: 'dashboard',
          component: () => import('@/views/dashboard/index.vue'),
          name: 'Dashboard',
          meta: {
            title: '工作台',
            icon: 'el-icon-position',
            affix: true,
          },
        },
        {
          path: '/statistics',
          component: () => import('@/views/statistics/index.vue'),
          meta: {
            title: '数据统计',
            icon: 'el-icon-pie-chart',
          },
        },
        {
          path: 'order',
          component: () => import('@/views/orderDetails/index.vue'),
          meta: {
            title: '订单管理',
            icon: 'el-icon-notebook-2',
          },
        },
        {
          path: 'setmedicine',
          component: () => import('@/views/setmedicine/index.vue'),
          meta: {
            title: '组合药管理',
            icon: 'el-icon-connection',
          },
        },

        {
          path: 'chinesewesternmedicine',
          component: () => import('@/views/chinesewesternmedicine/index.vue'),
          meta: {
            title: '中/西药管理',
            icon: 'el-icon-open',
          },
        },
        {
          path: '/chinesewesternmedicine/add',
          component: () =>
            import(
              '@/views/chinesewesternmedicine/addChineseWesternMedicinetype.vue'
            ),
          meta: {
            title: '添加药品（中/西药）',
            hidden: true,
          },
        },
        {
          path: 'chinesemedicine',
          component: () =>
            import(
              '@/views/ChineseMedicine/chinese.vue'
            ), 
          meta: {
            title: '中药管理', 
            icon: 'el-icon-coin',
          },
        },
        {
          path: '/chinesemedicine/add',
          component: () =>
            import(
              '@/views/ChineseMedicine/addChineseMedicinetype.vue'
            ),
          meta: {
            title: '添加中药',
            hidden: true,
          },
        },
        {
          path: 'westernmedicine', 
          component: () =>
            import(
              '@/views/WesternMedicine/western.vue'
            ), 
          meta: {
            title: '西药管理',
            icon: 'el-icon-magic-stick',
          },
        },
        {
          path: '/westernmedicine/add',
          component: () =>
            import(
              '@/views/WesternMedicine/addWesternMedicinetype.vue'
            ),
          meta: {
            title: '添加西药',
            hidden: true,
          },
        },

        {
          path: 'category',
          component: () => import('@/views/category/index.vue'),
          meta: {
            title: '分类管理',
            icon: 'el-icon-film',
          },
        },
        {
          path: 'employee',
          component: () => import('@/views/employee/index.vue'),
          meta: {
            title: '员工管理',
            icon: 'el-icon-user',
          },
        },

        {
          path: '/employee/add',
          component: () => import('@/views/employee/addEmployee.vue'),
          meta: {
            title: '添加员工',
            hidden: true,
          },
        },

        {
          path: '/setmedicine/add',
          component: () => import('@/views/setmedicine/addSetmedicine.vue'),
          meta: {
            title: '添加组合药信息',
            hidden: true,
          },
        },
      ],
    },
    {
      path: '*',
      redirect: '/404',
      meta: { hidden: true },
    },
  ],
})

export default router
